/ BBS in a Box 12
/ BBS in a box XII-1.iso / Files / System7 tools / AppleScript / Script Tools 1.3.sit / Script Tools / Examples / File IO Example ![]() | < prev | next > |
MacBinary | 1993-09-24 | 1.6 KB | [TEXT/ToyS] |
Confidence | Program | Detection | Match Type | Support |
---|---|---|---|---|
10% | dexvert | MacBinary (archive/macBinary) | fallback | Supported |
1% | dexvert | Text File (text/txt) | fallback | Supported |
100% | file | MacBinary II, inited, Fri Sep 24 19:11:52 1993, modified Fri Sep 24 19:11:52 1993, creator 'ToyS', type ASCII, 832 bytes "File IO Example" , at 0x3c0 632 bytes resource | default (weak) | |
99% | file | data | default | |
74% | TrID | Macintosh plain text (MacBinary) | default | |
25% | TrID | MacBinary 2 | default (weak) | |
100% | siegfried | fmt/1762 MacBinary (II) | default | |
100% | lsar | MacBinary | default |
id metadata | |
---|---|
key | value |
macFileType | [TEXT] |
macFileCreator | [ToyS] |
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0f 46 69 6c 65 20 49 | 4f 20 45 78 61 6d 70 6c |..File I|O Exampl|
|00000010| 65 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |e.......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 54 6f 79 | 53 01 00 00 00 00 00 00 |.TEXTToy|S.......|
|00000050| 00 00 00 00 00 03 40 00 | 00 02 78 a8 c9 2f 38 a8 |......@.|..x../8.|
|00000060| c9 2f 38 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |./8.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ad 73 00 00 |........|.....s..|
|00000080| 2d 2d 0d 2d 2d 09 41 73 | 6b 20 74 68 65 20 75 73 |--.--.As|k the us|
|00000090| 65 72 20 74 6f 20 66 6f | 72 20 74 68 65 20 6e 61 |er to fo|r the na|
|000000a0| 6d 65 20 61 6e 64 20 6c | 6f 63 61 74 69 6f 6e 20 |me and l|ocation |
|000000b0| 6f 66 20 74 68 65 20 6e | 65 77 20 66 69 6c 65 0d |of the n|ew file.|
|000000c0| 2d 2d 0d 73 65 74 20 6e | 65 77 46 69 6c 65 20 74 |--.set n|ewFile t|
|000000d0| 6f 20 63 68 6f 6f 73 65 | 20 6e 65 77 20 66 69 6c |o choose| new fil|
|000000e0| 65 20 77 69 74 68 20 70 | 72 6f 6d 70 74 20 22 50 |e with p|rompt "P|
|000000f0| 69 63 6b 20 61 20 6e 65 | 77 20 66 69 6c 65 20 6e |ick a ne|w file n|
|00000100| 61 6d 65 3a 22 0d 73 65 | 74 20 6e 65 77 46 69 6c |ame:".se|t newFil|
|00000110| 65 50 61 74 68 20 74 6f | 20 28 66 6f 6c 64 65 72 |ePath to| (folder|
|00000120| 20 72 65 74 75 72 6e 65 | 64 20 6f 66 20 6e 65 77 | returne|d of new|
|00000130| 46 69 6c 65 20 61 73 20 | 73 74 72 69 6e 67 29 20 |File as |string) |
|00000140| 26 20 28 6e 61 6d 65 20 | 72 65 74 75 72 6e 65 64 |& (name |returned|
|00000150| 20 6f 66 20 6e 65 77 46 | 69 6c 65 29 0d 0d 2d 2d | of newF|ile)..--|
|00000160| 0d 2d 2d 09 49 66 20 74 | 68 65 20 66 69 6c 65 20 |.--.If t|he file |
|00000170| 61 6c 72 65 61 64 79 20 | 65 78 69 73 74 73 20 64 |already |exists d|
|00000180| 65 6c 65 74 65 20 69 74 | 0d 2d 2d 0d 69 66 20 28 |elete it|.--.if (|
|00000190| 72 65 70 6c 61 63 69 6e | 67 20 6f 66 20 6e 65 77 |replacin|g of new|
|000001a0| 46 69 6c 65 29 20 74 68 | 65 6e 20 c2 0d 09 64 65 |File) th|en ...de|
|000001b0| 6c 65 74 65 20 66 69 6c | 65 20 61 6c 69 61 73 20 |lete fil|e alias |
|000001c0| 6e 65 77 46 69 6c 65 50 | 61 74 68 0d 0d 2d 2d 0d |newFileP|ath..--.|
|000001d0| 2d 2d 09 43 72 65 61 74 | 65 20 74 68 65 20 66 69 |--.Creat|e the fi|
|000001e0| 6c 65 20 61 6e 64 20 77 | 72 69 74 65 20 73 6f 6d |le and w|rite som|
|000001f0| 65 20 64 61 74 61 20 74 | 6f 20 69 74 0d 2d 2d 0d |e data t|o it.--.|
|00000200| 63 72 65 61 74 65 20 66 | 69 6c 65 20 28 66 69 6c |create f|ile (fil|
|00000210| 65 6e 61 6d 65 20 72 65 | 74 75 72 6e 65 64 20 6f |ename re|turned o|
|00000220| 66 20 6e 65 77 46 69 6c | 65 29 20 69 6e 20 28 66 |f newFil|e) in (f|
|00000230| 6f 6c 64 65 72 20 72 65 | 74 75 72 6e 65 64 20 6f |older re|turned o|
|00000240| 66 20 6e 65 77 46 69 6c | 65 29 20 c2 0d 09 6f 77 |f newFil|e) ...ow|
|00000250| 6e 65 72 20 22 74 74 78 | 74 22 20 2d 2d 20 54 65 |ner "ttx|t" -- Te|
|00000260| 61 63 68 54 65 78 74 0d | 73 65 74 20 72 65 66 4e |achText.|set refN|
|00000270| 75 6d 20 74 6f 20 6f 70 | 65 6e 20 66 69 6c 65 20 |um to op|en file |
|00000280| 61 6c 69 61 73 20 6e 65 | 77 46 69 6c 65 50 61 74 |alias ne|wFilePat|
|00000290| 68 0d 77 72 69 74 65 20 | 66 69 6c 65 20 72 65 66 |h.write |file ref|
|000002a0| 4e 75 6d 20 74 65 78 74 | 20 22 54 68 69 73 20 66 |Num text| "This f|
|000002b0| 69 6c 65 20 69 73 20 61 | 6e 20 65 78 61 6d 70 6c |ile is a|n exampl|
|000002c0| 65 20 6f 66 20 61 20 73 | 69 6d 70 6c 65 20 74 65 |e of a s|imple te|
|000002d0| 78 74 20 66 69 6c 65 20 | 77 68 69 63 68 20 63 61 |xt file |which ca|
|000002e0| 6e 20 62 65 20 63 72 65 | 61 74 65 64 20 75 73 69 |n be cre|ated usi|
|000002f0| 6e 67 20 74 68 65 20 46 | 69 6c 65 20 49 2f 4f 20 |ng the F|ile I/O |
|00000300| 41 70 70 6c 65 53 63 72 | 69 70 74 20 61 64 64 69 |AppleScr|ipt addi|
|00000310| 74 69 6f 6e 73 20 70 72 | 6f 76 69 64 65 64 20 69 |tions pr|ovided i|
|00000320| 6e 20 53 63 72 69 70 74 | 20 54 6f 6f 6c 73 22 0d |n Script| Tools".|
|00000330| 77 72 69 74 65 20 66 69 | 6c 65 20 72 65 66 4e 75 |write fi|le refNu|
|00000340| 6d 20 74 65 78 74 20 22 | 22 0d 77 72 69 74 65 20 |m text "|".write |
|00000350| 66 69 6c 65 20 72 65 66 | 4e 75 6d 20 74 65 78 74 |file ref|Num text|
|00000360| 20 22 2d 4d 61 72 6b 22 | 0d 63 6c 6f 73 65 20 66 | "-Mark"|.close f|
|00000370| 69 6c 65 20 72 65 66 4e | 75 6d 0d 2d 2d 0d 2d 2d |ile refN|um.--.--|
|00000380| 09 4e 6f 74 65 20 68 6f | 77 20 54 65 61 63 68 54 |.Note ho|w TeachT|
|00000390| 65 78 74 20 74 72 65 61 | 74 73 20 65 61 63 68 20 |ext trea|ts each |
|000003a0| 6c 69 6e 65 20 61 73 20 | 61 20 73 65 70 65 72 61 |line as |a sepera|
|000003b0| 74 65 20 70 61 72 61 67 | 72 61 70 68 2e 0d 2d 2d |te parag|raph..--|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000400| 00 00 01 00 00 00 02 1e | 00 00 01 1e 00 00 00 5a |........|.......Z|
|00000410| 00 00 90 22 0f 45 78 63 | 68 61 6e 67 65 20 46 69 |...".Exc|hange Fi|
|00000420| 6c 65 2e b9 02 00 00 00 | 50 52 4f 4a 4b 41 48 4c |le......|PROJKAHL|
|00000430| 0f 46 69 6c 65 20 49 4f | 20 45 78 61 6d 70 6c 65 |.File IO| Example|
|00000440| 02 00 00 00 54 45 58 54 | 54 6f 79 53 01 00 00 68 |....TEXT|ToyS...h|
|00000450| 00 00 54 45 58 54 54 6f | 79 53 01 00 00 68 00 c0 |..TEXTTo|yS...h..|
|00000460| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000470| 00 00 a8 4b b8 85 00 00 | 03 40 00 00 02 78 00 00 |...K....|.@...x..|
|00000480| 00 00 00 00 00 00 00 00 | 00 00 0d 00 00 00 90 22 |........|......."|
|00000490| 07 46 69 6c 65 20 49 4f | 02 00 00 00 6f 73 61 78 |.File IO|....osax|
|000004a0| 61 73 63 72 01 00 00 68 | 00 80 00 00 00 00 af ae |ascr...h|........|
|000004b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 1c 3a |........|.......:|
|000004c0| 00 00 1e 00 a8 4b c5 57 | a8 c7 95 84 00 00 00 00 |.....K.W|........|
|000004d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 06 ca |........|........|
|000004f0| 00 03 00 00 00 00 00 00 | 00 00 00 00 00 00 0f 00 |........|........|
|00000500| 00 00 00 c2 46 69 6c 65 | 20 49 4f 20 41 64 64 69 |....File| IO Addi|
|00000510| 74 69 6f 6e 20 45 78 61 | 6d 70 6c 65 0d 43 6f 70 |tion Exa|mple.Cop|
|00000520| 79 72 69 67 68 74 20 a9 | 20 31 39 39 33 20 4d 61 |yright .| 1993 Ma|
|00000530| 72 6b 20 41 6c 6c 64 72 | 69 74 74 0d 41 6c 6c 20 |rk Alldr|itt.All |
|00000540| 52 69 67 68 74 73 20 52 | 65 73 65 72 76 65 64 0d |Rights R|eserved.|
|00000550| 0d 54 68 69 73 20 73 63 | 72 69 70 74 20 69 6c 6c |.This sc|ript ill|
|00000560| 75 73 74 72 61 74 65 73 | 20 68 6f 77 20 74 6f 20 |ustrates| how to |
|00000570| 75 73 65 20 74 68 65 20 | 53 63 72 69 70 74 20 54 |use the |Script T|
|00000580| 6f 6f 6c 73 20 66 69 6c | 65 20 49 4f 20 63 6f 6d |ools fil|e IO com|
|00000590| 6d 61 6e 64 73 20 74 6f | 20 63 72 65 61 74 65 20 |mands to| create |
|000005a0| 61 20 74 65 78 74 20 66 | 69 6c 65 20 61 6e 64 20 |a text f|ile and |
|000005b0| 77 72 69 74 65 20 73 6f | 6d 65 20 74 65 78 74 20 |write so|me text |
|000005c0| 74 6f 20 69 74 2e 00 00 | 00 3e 00 03 00 00 00 00 |to it...|.>......|
|000005d0| 00 0c 00 09 00 10 00 00 | 00 0a 00 00 00 00 00 00 |........|........|
|000005e0| 00 00 00 4b 00 0e 00 0a | 00 10 00 00 00 0c 00 00 |...K....|........|
|000005f0| 00 00 00 00 00 00 00 4d | 00 0c 00 09 00 16 00 00 |.......M|........|
|00000600| 00 0a 00 00 00 00 00 00 | 00 00 00 12 00 2b 00 04 |........|.....+..|
|00000610| 01 ff 02 6a 00 28 00 02 | 01 8d 02 5d 00 00 00 00 |...j.(..|...]....|
|00000620| 01 00 00 00 02 1e 00 00 | 01 1e 00 00 00 5a 00 4a |........|.....Z.J|
|00000630| 4d f4 14 34 00 00 00 1c | 00 5a 00 02 54 45 58 54 |M..4....|.Z..TEXT|
|00000640| 00 00 00 1a 73 74 79 6c | 00 00 00 26 57 50 6f 73 |....styl|...&WPos|
|00000650| 00 00 00 32 04 68 ff ff | 00 00 00 00 00 4a 4d 28 |...2.h..|.....JM(|
|00000660| 04 68 ff ff 00 00 00 c6 | 00 4a 4d d0 00 80 ff ff |.h......|.JM.....|
|00000670| 00 00 01 08 00 4a 4c f8 | 00 00 00 00 00 00 00 00 |.....JL.|........|
+--------+-------------------------+-------------------------+--------+--------+